package com.mogen.app.dentistry;

import android.app.Activity;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;

import com.mogen.app.R;

public class MogenDentistryActivity extends Activity {

    private Button btnAction1, btnAction2, btnAction3, btnAction4;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	initControls();
    }

    private void initControls() {
	btnAction1 = (Button) findViewById(R.id.main_btn_act1);
	btnAction2 = (Button) findViewById(R.id.main_btn_act2);
	btnAction3 = (Button) findViewById(R.id.main_btn_act3);
	btnAction4 = (Button) findViewById(R.id.main_btn_act4);

	Animation animation = AnimationUtils.loadAnimation(this,
		R.anim.a_fade_display);

	btnAction1.setAnimation(animation);
	btnAction2.setAnimation(animation);
	btnAction3.setAnimation(animation);
	btnAction4.setAnimation(animation);

	btnAction1.setOnClickListener(new OnClickListener() {

	    @Override
	    public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent = new Intent();
		intent.setClass(MogenDentistryActivity.this,
			ActivityView1.class);
		startActivity(intent);
	    }
	});

	btnAction2.setOnClickListener(new OnClickListener() {

	    @Override
	    public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent = new Intent();
		intent.setClass(MogenDentistryActivity.this,
			ActivityView2.class);
		startActivity(intent);
	    }
	});

	btnAction3.setOnClickListener(new OnClickListener() {

	    @Override
	    public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent = new Intent();
		intent.setClass(MogenDentistryActivity.this,
			ActivityView3.class);
		startActivity(intent);
	    }
	});

	btnAction4.setOnClickListener(new OnClickListener() {

	    @Override
	    public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent = new Intent();
		intent.setClass(MogenDentistryActivity.this,
			ActivityView4.class);
		startActivity(intent);
	    }
	});

	btnAction1.setOnTouchListener(new OnTouchListener() {

	    @Override
	    public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub

		if (event.getAction() == MotionEvent.ACTION_DOWN) {
		    ViewGroup vg = (ViewGroup) MogenDentistryActivity.this
			    .findViewById(R.id.main_content);
		    vg.setBackgroundResource(R.drawable.door1_open);
		}

		return false;
	    }
	});

	btnAction2.setOnTouchListener(new OnTouchListener() {

	    @Override
	    public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub

		if (event.getAction() == MotionEvent.ACTION_DOWN) {
		    ViewGroup vg = (ViewGroup) MogenDentistryActivity.this
			    .findViewById(R.id.main_content);
		    vg.setBackgroundResource(R.drawable.door2_open);
		}

		return false;
	    }
	});

	btnAction3.setOnTouchListener(new OnTouchListener() {

	    @Override
	    public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub

		if (event.getAction() == MotionEvent.ACTION_DOWN) {
		    ViewGroup vg = (ViewGroup) MogenDentistryActivity.this
			    .findViewById(R.id.main_content);
		    vg.setBackgroundResource(R.drawable.door3_open);
		}

		return false;
	    }
	});

	btnAction4.setOnTouchListener(new OnTouchListener() {

	    @Override
	    public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub

		if (event.getAction() == MotionEvent.ACTION_DOWN) {
		    ViewGroup vg = (ViewGroup) MogenDentistryActivity.this
			    .findViewById(R.id.main_content);
		    vg.setBackgroundResource(R.drawable.door4_open);
		}

		return false;
	    }
	});

    }
}